/*
  Example for different sending methods
  
  https://github.com/sui77/rc-switch/
  
*/

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {

  Serial.begin(9600);

  // 发射端使用gpio,接收端使用中0和1对应
  // Transmitter is connected to Arduino Pin #10  
  mySwitch.enableTransmit(0);
  
  // Optional set protocol (default is 1, will work for most outlets)
  // mySwitch.setProtocol(2);

  // Optional set pulse length.
  // mySwitch.setPulseLength(320);
  
  // Optional set number of transmission repetitions.
  // mySwitch.setRepeatTransmit(15);
  
}

void loop() {
    mySwitch.send(2499600, 12);
    Serial.println("Send 433 Code: 2499600 厅离卧室近吸顶灯开");
    delay(5000);

    mySwitch.send(5529536, 12);
    Serial.println("Send 433 Code: 5529536 厅离卧室近吸顶灯关");
    delay(5000);

    mySwitch.send(1531148, 12);
    Serial.println("Send 433 Code: 1531148 单片机开灯");
      mySwitch.send(1531148, 12);
    Serial.println("Send 433 Code: 1531148 单片机开灯");
      mySwitch.send(1531148, 12);
    Serial.println("Send 433 Code: 1531148 单片机开灯");
    delay(5000);

    mySwitch.send(1531139, 12);
    Serial.println("Send 433 Code: 1531139 单片机关灯");
    mySwitch.send(1531139, 12);
    Serial.println("Send 433 Code: 1531139 单片机关灯");
    mySwitch.send(1531139, 12);
    Serial.println("Send 433 Code: 1531139 单片机关灯");    
    delay(5000);
    
  
  /* Same switch as above, but using decimal code */
//  mySwitch.send(1, 24);
//  Serial.println("Send 433 Code: 1");
//  delay(2000);  
//  mySwitch.send(2, 24);
//  Serial.println("Send 433 Code: 2");
//  delay(2000);




  

//  /* See Example: TypeA_WithDIPSwitches */
//  mySwitch.switchOn("11111", "00010");
//  delay(1000);
//  mySwitch.switchOff("11111", "00010");
//  delay(1000);
  

  /* Same switch as above, but using binary code */
//  mySwitch.send("010101111101010100111111");
//  delay(1000);  
//  Serial.println("Send 433 Code: 010101111101010100111111");

//  /* Same switch as above, but tri-state code */ 
//  mySwitch.sendTriState("00000FFF0F0F");
//  delay(1000);  
//  mySwitch.sendTriState("00000FFF0FF0");
//  delay(1000);

//   delay(20000);
}
